﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LIB;
using System.Web.Security;
public partial class admin_admin : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
    }
    protected override void OnInit(EventArgs e)
    {
        try
        {
            base.OnInit(e);
            if (!AuthenticateUtility.IsAuthenticated())
                FormsAuthentication.RedirectToLoginPage();
            else
            {
                Users_Info userInfo = AuthenticateUtility.GetUserInfo();
                lblUserName.Text = userInfo.username;
                lblLastLogin.Text = ConvertUtility.ConvertDateTimeVN_All(userInfo.lastLogin);
                
            }
        }
        catch (Exception ex)
        { }
    }

    protected void cmdLogout_Click(object sender, EventArgs e)
    {
        Users_Info userInfo = AuthenticateUtility.GetUserInfo();
        userInfo.lastLogin = DateTime.Now;
        userInfo.SaveAndFlush();
        AuthenticateUtility.LogoutUser();
        FormsAuthentication.RedirectToLoginPage();
    }
}
